package main

import "fmt"
import "net/http"
import "github.com/elazarl/go-bindata-assetfs"

func login(w http.ResponseWriter, r *http.Request) {
    r.ParseForm()
    fmt.Println(r.Form)
   
    str := `{"code":0,"nick_name":"12","grade":"1","token":"c392fc315ae3450bb9608f402bb5c71e","company_name":"1","msg":"登录成功","user_name":"72"}`
    fmt.Fprintf(w, str)
}
func userinfo(w http.ResponseWriter, r *http.Request) {
    str := `{"code":0,"name":"12","roles":"admin","grade":"1","token":"c392fc315ae3450bb9608f402bb5c71e","company_name":"1","user_name":"72"}`
    fmt.Fprintf(w, str)
}
func main() {
    http.Handle("/", http.FileServer(&assetfs.AssetFS{Asset:Asset, AssetDir:AssetDir, AssetInfo:AssetInfo, Prefix:"dist"}))
    http.HandleFunc("/api/v1/login", login)
    http.HandleFunc("/api/v2/userinfo", userinfo)
    http.ListenAndServe(":12345", nil)   
}

